﻿using System;
using Character;
using UnityEngine;

// Token: 0x02000158 RID: 344
public class Mannequin : MonoBehaviour
{
	// Token: 0x1700011F RID: 287
	// (get) Token: 0x060008EC RID: 2284 RVA: 0x00033EA4 File Offset: 0x000320A4
	// (set) Token: 0x060008ED RID: 2285 RVA: 0x00033EAC File Offset: 0x000320AC
	public Wears wears { get; protected set; }

	// Token: 0x17000120 RID: 288
	// (get) Token: 0x060008EE RID: 2286 RVA: 0x00033EB8 File Offset: 0x000320B8
	// (set) Token: 0x060008EF RID: 2287 RVA: 0x00033EC0 File Offset: 0x000320C0
	public Accessories accessories { get; protected set; }

	// Token: 0x060008F0 RID: 2288 RVA: 0x00033ECC File Offset: 0x000320CC
	private void Awake()
	{
		string name = (this.sex != SEX.FEMALE) ? "cm_J_Head_s" : "cf_J_Head_s";
		Transform transform = Transform_Utility.FindTransform(base.transform, name);
		this.wearParam = new WearParameter(this.sex);
		this.acceParan = new AccessoryParameter(this.sex);
		this.wears = new Wears(this.sex, this.wearParam, base.transform, null);
		this.accessories = new Accessories(this.sex, base.transform);
	}

	// Token: 0x060008F1 RID: 2289 RVA: 0x00033F58 File Offset: 0x00032158
	public void FromHuman(Human human)
	{
		if (human.sex != this.sex)
		{
			GlobalData.Debug_LogError("人类和人体模型的性别不同");
			return;
		}
		this.wearParam.Copy(human.customParam.wear);
		for (WEAR_TYPE wear_TYPE = WEAR_TYPE.TOP; wear_TYPE < WEAR_TYPE.NUM; wear_TYPE++)
		{
			this.wears.WearInstantiate(wear_TYPE, this.skinMaterial, null);
		}
		this.wears.CheckShow(true);
		this.acceParan.Copy(human.customParam.acce);
		for (int i = 0; i < 10; i++)
		{
			this.accessories.AccessoryInstantiate(this.acceParan, i, false, null);
		}
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x060008F2 RID: 2290 RVA: 0x0003400C File Offset: 0x0003220C
	public void Strip()
	{
		this.wearParam.Init();
		for (WEAR_TYPE wear_TYPE = WEAR_TYPE.TOP; wear_TYPE < WEAR_TYPE.NUM; wear_TYPE++)
		{
			this.wears.DeleteWear(wear_TYPE);
		}
		this.wears.CheckShow(true);
		this.acceParan.Init();
		for (int i = 0; i < 10; i++)
		{
			this.accessories.DeleteAccessory(i);
		}
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x04000879 RID: 2169
	public SEX sex;

	// Token: 0x0400087A RID: 2170
	[SerializeField]
	private Material skinMaterial;

	// Token: 0x0400087D RID: 2173
	private WearParameter wearParam;

	// Token: 0x0400087E RID: 2174
	private AccessoryParameter acceParan;

	// Token: 0x0400087F RID: 2175
	private const string HeadParentName_M = "cm_J_Head_s";

	// Token: 0x04000880 RID: 2176
	private const string HeadParentName_F = "cf_J_Head_s";
}
